<%@ page import="com.Gastos" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="main" />
<g:set var="entityName"
	value="${message(code: 'gastos.label', default: 'Gastos')}" />
<title><g:message code="default.create.label"
		args="[entityName]" />
</title>
</head>
<body>
	<div class="nav">
		<span class="menuButton"><a class="home"
			href="${createLink(uri: '/')}"><g:message
					code="default.home.label" />
		</a>
		</span> <span class="menuButton"><g:link class="list" action="list">
				<g:message code="default.list.label" args="[entityName]" />
			</g:link>
		</span>
	</div>
	<h1 id="pageName">
		Cria
		Gastos
	</h1>

	<g:if test="${flash.message}">
		<div class="message">${flash.message}</div>
	</g:if>
	<g:hasErrors bean="${gastosInstance}">
		<div class="errors">
			<g:renderErrors bean="${gastosInstance}" as="list" />
		</div>
	</g:hasErrors>
	<g:form action="save">
		<fieldset class="tableField">
			<legend>Dados Gasto:</legend>
			<table class="IadTableForm">
				<tbody>
					<tr class="prop">
						<td valign="top" class="name"><label for="fornecedor"><g:message
									code="gastos.fornecedor.label" default="Fornecedor" /></label></td>
						<td valign="top"
							class="value ${hasErrors(bean: gastosInstance, field: 'fornecedor', 'errors')}">
							<g:select name="fornecedor.id" from="${com.Fornecedor.list()}"
								optionKey="id" value="${gastosInstance?.fornecedor?.id}" />
						</td>
					</tr>
					<tr class="prop">
						<td valign="top" class="name"><label for="tipoOperacao"><g:message
									code="fornecedor.tipoOperacao.label" default="Tipo Operacao" /></label></td>
						<td valign="top"
							class="value ${hasErrors(bean: gastosInstance, field: 'tipoOperacao', 'errors')}">
							<g:select name="tipoOperacao.id"
								from="${com.TipoDeOperacao.list()}" optionKey="id"
								value="${gastosInstance?.tipoOperacao?.id}" />
						</td>
					</tr>

					<tr class="prop">
						<td valign="top" class="name"><label for="descricao"><g:message
									code="gastos.descricao.label" default="Descricao" /></label></td>
						<td valign="top"
							class="value ${hasErrors(bean: gastosInstance, field: 'descricao', 'errors')}">
							<g:textArea name="descricao" cols="40" rows="5"
								value="${gastosInstance?.descricao}" />
						</td>
					</tr>

					<tr class="prop">
						<td valign="top" class="name"><label for="dateVenda"><g:message
									code="gastos.dateGasto.label" default="Date Gasto" /></label></td>
						<td valign="top"
							class="value ${hasErrors(bean: gastosInstance, field: 'dateGasto', 'errors')}">
							<g:datePicker name="dateGasto" precision="day"
								value="${gastosInstance?.dateGasto}" />
						</td>
					</tr>
				</tbody>
			</table>
		</fieldset>
		<fieldset class="tableField">
			<legend>Pagamento</legend>
			<table class="IadTableForm">
				<tbody>
					<tr class="prop">
						<td valign="top" class="name"><label for="formaPagamento"><g:message
									code="gastos.formaPagamento.label" default="Forma Pagamento" /></label></td>
						<td valign="top"
							class="value ${hasErrors(bean: gastosInstance, field: 'formaPagamento', 'errors')}">
							<g:select name="formaPagamento"
								from="${gastosInstance.constraints.formaPagamento.inList}"
								value="${gastosInstance?.formaPagamento}"
								valueMessagePrefix="gastos.formaPagamento" />
						</td>
						<td valign="top" class="name"><label for="entrada">Entrada</label></td>
						<td valign="top"
							class="value ${hasErrors(bean: gastosInstance, field: 'entrada', 'errors')}">
							<g:checkBox name="entrada" id="entrada"
								value="${gastosInstance?.entrada}" />
								
						</td>
					</tr>
					
					<tr class="prop">
						<td valign="top" class="name"><label for="valor"><g:message
									code="gastos.valor.label" default="Valor" /></label></td>
						<td valign="top"
							class="value ${hasErrors(bean: gastosInstance, field: 'valor', 'errors')}">
							<g:textField name="valor" id="valor"
								value="${fieldValue(bean: gastosInstance, field: 'valor')}" />
						</td>

						<td valign="top" class="name"><label for="parcelas"><g:message
									code="gastos.parcelas.label" default="Parcelas" /></label></td>
						<td class="value ${hasErrors(bean: gastosInstance, field: 'parcelas', 'errors')}">
							<g:textField name="parcelas" id="parcela"
								value="${fieldValue(bean: gastosInstance, field: 'parcelas')}" />
						</td>
					</tr>
				</tbody>
		</table>
		</fieldset>
		<div class="buttons">
			<span class="button"><g:submitButton name="create"
					class="save"
					value="${message(code: 'default.button.create.label', default: 'Create')}" />
			</span>
		</div>
	</g:form>
</body>
</html>
